#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	int n, m;
	int **M;
	register int i = 0, j = 0;
	int from, to;

	(void) freopen("adjmatrix.in", "r", stdin);
	(void) freopen("adjmatrix.out", "w", stdout);
	(void) scanf("%d%d", &n, &m);
	M = (int**) calloc(n, sizeof(int*));
	while (i < n) {
		M[i] = (int*) calloc(n, sizeof(int));
		i++;
	}
	i = 0;
	while (i < m) {
		(void) scanf("%d%d", &from, &to);
		i++;
		from--;
		to--;
		M[from][to] = M[to][from] = 1;
	}
	i = 0;
	while (i < n) {
		j=0;
		while (j < n)
			printf("%d ", M[i][j++]);
		putchar('\n');
		i++;
	}
	i = 0;
	while (i < n) free(M[i++]);
	free(M);
	return 0;
}
